<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/css/base.css">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/css/style.css">
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-2.1.4.min.js"></script>
		<title>订单管理-我的订单-我的需求</title>
	</head>
	<body>
		<div class="page">
			<div class="header">
				<div class="header_top"></div>
				<div class="header_bottom clearfix">
					<div class="header_logo fl">
						<img src="${pageContext.request.contextPath}/images/images/index-logo.png">
					</div>
					<ul class="header_nav clearfix fl">
						<li>
							<a href="${pageContext.request.contextPath}/morder/waitOrderList.html" class="on">订单管理</a>
						</li>
						<li>
							<a href="${pageContext.request.contextPath}/staff/queryAllList/1.html">家政人员管理</a>
						</li>
						<li>
							<a href="${pageContext.request.contextPath}/supplier/account.html">财务管理</a>
						</li>
						<li>
							<a href="${pageContext.request.contextPath}/admin/accountInfo.html" >账户管理</a>
						</li>
					</ul>
					<div class="header_user fr">
						<img src="${pageContext.request.contextPath}/images/images/user.png">欢迎您，<i>${ sessionScope.MANAGER_NAME} </i><a href="${pageContext.request.contextPath}/manager/loginout.html">【切换账号】</a>
					</div>
				</div>
			</div>
			<div class="main clearfix">
				<div class="main_menu fl">
				
				
					<div class="menu_name">
						<a href="${pageContext.request.contextPath}/morder/waitOrderList.html">
							<img src="${pageContext.request.contextPath}/images/images/ddc.png">
							<p>订单池</p>
						</a>
					</div>
					<div class="menu_name">
						<a href="${pageContext.request.contextPath}/need/waitNeedList/1.html">
							<img src="${pageContext.request.contextPath}/images/images/xqc.png">
							<p>需求池</p>
						</a>
					</div>
					<div class="menu_name on">
						<a href="${pageContext.request.contextPath}/morder/assignList/1.html">
							<img src="${pageContext.request.contextPath}/images/images/wddd.png">
							<p>我的订单</p>
						</a>
					</div>
					
				</div>
				<div class="main_cont fl">
					<div class="main_cont_top">
						<div class="main_inner clearfix">
							<div class="cont_top_title fl">当前位置：订单管理 > 我的订单 > 我的需求</div>
							<div class="cont_top_time fr"> <i><img src="${pageContext.request.contextPath}/images/images/refresh.png">
							<a href="${pageContext.request.contextPath}/need/waitNeedList/1.html?flag=1">刷新</a>
							</i></div>
						</div>
					</div>
					<div class="main_cont_top">
						<div class="main_inner clearfix">
						<%-- 	<div class="cont_top_title fl">我的嘿币：<i>${suMoney}</i> 元</div> --%>
							<div class="cont_top_time fr">
								<!-- <select>  
									<option value ="全部订单">全部订单</option>
								</select> -->
								<form action="${pageContext.request.contextPath}/need/waitNeedList/1.html" id="youform">
								下单时间：<input class="Wdate" type="text" onClick="WdatePicker()" name="starts">  到  
								<input class="Wdate" type="text" onClick="WdatePicker()" name="ends">
								<input  type="hidden"  name="flag" value="1">
								<input type="submit" value="订单搜索" class="search" >
								</form>
							</div>
						</div>
					</div>
					<div class="main_cont_bottom_xqc">
						<div class="main_inner">
						
						<ul class="main_cont_title clearfix">
								<li>
									<a href="${pageContext.request.contextPath}/morder/allOrderList/3/1.html" <c:if test="${sign eq 3}">class="on"</c:if>>待分配</a>
								</li>
								<li>
									<a href="${pageContext.request.contextPath}/morder/allOrderList/8/1.html" <c:if test="${sign eq 8}">class="on"</c:if> >待验收</a>
								</li>
								<li>
									<a href="${pageContext.request.contextPath}/morder/allOrderList/6/1.html" <c:if test="${sign eq 6}">class="on"</c:if> >交易成功</a>
								</li>
								<li>
									<a href="${pageContext.request.contextPath}/morder/allOrderList/5/1.html" <c:if test="${sign eq 5}">class="on"</c:if> >交易失败</a>
								</li>
								<li>
									<a href="${pageContext.request.contextPath}/need/waitNeedList/1.html?flag=1"  class="on">我的需求</a>
								</li>
							</ul>
						
							<table>
							    <thead>
							    <tr> 
							        <th style="width:5%">需求编号</th> 
							        <th style="width:10%">需求工种</th>
							        <th style="width:5%">需求价格</th> 
							        <th style="width:15%">服务地址</th>
							        <th style="width:15%">需求提交时间</th> 
							        <th style="width:10%">状态</th>
							        <th style="width:20%">操作</th>
							    </tr>
							    </thead>  
							    <tbody>
							    <c:forEach items="${PAGE_BEAN.dataList}" var="need">
									<tr class="text-c">
										<td><c:out value="${need.id}"/></td>
										<td> 
										<c:if test="${need.wNeedType eq 9}">
											月嫂
										</c:if>
										<c:if test="${need.wNeedType eq 7}">
											医院护工
										</c:if>
										<c:if test="${need.wNeedType eq 8}">
											育婴师
										</c:if>
										<c:if test="${need.wNeedType eq 6}">
											保姆
										</c:if>
										<c:if test="${need.wNeedType eq 10}">
											看护老人
										</c:if>
									</td>
										<td><c:out value="${need.wFeeType}"/></td>
										<td><c:out value="${need.wAddress}"/></td>
										<td><fmt:formatDate value="${need.createTime}" type="BOTH" dateStyle="full"/></td>
										<td>
										<c:if test="${need.status eq 2}">
											已抢单
										</c:if>
										<c:if test="${need.status eq 3}">
											完成
										</c:if>
										<c:if test="${need.status eq 4}">
											取消
										</c:if>
										</td>
										<td class="td-manage">
											<button type="button"  onclick="showdetail(${need.id});" >查看详情</button>
											
											<c:if test="${need.status eq 2}">
											<button type="button" onclick="changeStatus(${need.id},3);" >完成</button>		
											<button type="button" onclick="changeStatus(${need.id},1);" >取消</button>
											</c:if>				
										</td>
									</tr>
								</c:forEach>
								</tbody> 
							</table>
							<%@ include file="/WEB-INF/views/page.jsp"%>
							<input type="hidden" id="sMoney" value="${suMoney}"/>
						</div>
					</div>
				</div>
			</div>
				<!--查看详情-->
			<div class="mask_ddxq">
				<div class="ckddxq">
					<img src="${pageContext.request.contextPath}/images/images/close.png" class="close" onclick="qxddxq();">
					<h3>订单详情</h3>
					<ul id="detail">
					</ul>
				</div>
			</div>
		</div>
		
		<script type="text/javascript" src="${pageContext.request.contextPath}/lib/layer/2.1/layer.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/lib/laypage/1.2/laypage.js"></script> 
		<script type="text/javascript" src="${pageContext.request.contextPath}/lib/My97DatePicker/WdatePicker.js"></script> 
		<script type="text/javascript" src="${pageContext.request.contextPath}/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
				<script type="text/javascript">
				$(function(){
					$('.table-sort').dataTable({
						"bLengthChange": false, //改变每页显示数据数量
						"aaSorting": [[ 1, "desc" ]],//默认第几个排序
						"bStateSave": true,//状态保存
						"bPaginate" : false,// 分页按钮  
						"aoColumnDefs": [
						  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
						  {"orderable":false,"aTargets":[0,3,3]}// 制定列不参与排序
						]
					});								
				});
				
				
				function showdetail(id){
					  $.ajax({
						  url: "${pageContext.request.contextPath}/need/findNeedById/"+id+".json",
						  success:function(data) {
								  var list=data.list;
								  $("#detail").html("");
								  $("#detail").append("<li>用户编号："+list[0].wMemberId+"</li>");
								  $("#detail").append("<li>用户名字："+list[0].wContact+"</li>"); 
								  $("#detail").append("<li>用户电话："+list[0].wMemberMobile+"</li>");
								  $("#detail").append("<li>需求价格："+list[0].wFeeType+"</li>");
								  $("#detail").append("<li>服务地址："+list[0].wAddress+"</li>");
								  
								  if(list[0].wIsLive!=null && list[0].wIsLive!=""){
									  $("#detail").append("<li>是否住家："+list[0].wIsLive+"</li>");
								  }
								  if(list[0].wAge!=null){
									  $("#detail").append("<li>期望年龄："+list[0].wAge+"</li>");
								  }
								  if(list[0].wOldGender!=null && list[0].wOldGender!=""){
									  $("#detail").append("<li>老人性别："+list[0].wOldGender+"</li>");
								  }
								  if(list[0].wOldType!=null && list[0].wOldType!=""){
									  $("#detail").append("<li>是否自理："+list[0].wOldType+"</li>");
								  }
								  if(list[0].wBabyAge!=null){
									  $("#detail").append("<li>孩子年龄："+list[0].wBabyAge+"</li>");
								  }
								  if(list[0].wEducation!=null && list[0].wEducation!=""){
									  $("#detail").append("<li>期望学历："+list[0].wEducation+"</li>");
								  }
								  if(list[0].wSizeType!=null && list[0].wSizeType!=""){
									  $("#detail").append("<li>面积大小："+list[0].wSizeType+"</li>");
								  }
								  
								  $("#detail").append("<li>用户备注："+list[0].wDesc+"</li>");
								  
								  $(".mask_ddxq").show(); 
						  }
					});   
				}
				
				function qxddxq(){
					$(".mask_ddxq").hide();
				}
				
				//成功和失败
				function changeStatus(id,flag){
					  $.ajax({
						  url: "${pageContext.request.contextPath}/need/changeStatus/"+id+"/"+flag+".json",
						  success:function(data) {
							  alert(data.info);
							  window.location.reload();
						  }
					  });
				}
					
				</script>
	</body>
</html>
